package com.mock.action.organisation;

import java.util.ArrayList;
import java.util.List;

import com.mock.dao.AddressDao;
import com.mock.dao.impl.AddressDaoImp;
import com.mock.model.Address;
import com.opensymphony.xwork2.ActionSupport;

public class CheckPostCodeAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String checkPostCode() throws Exception {
		List<Address> addresses = addressDao.getAllAddress();
		postcodes = new ArrayList<String>();
		for (Address address : addresses) {
			postcodes.add(address.getPostcode());
		}
		return SUCCESS;
	}
	
	private AddressDao addressDao = new AddressDaoImp();
	private List<String> postcodes = new ArrayList<String>();

	public List<String> getPostcodes() {
		return postcodes;
	}
	public void setPostcodes(List<String> postcodes) {
		this.postcodes = postcodes;
	}
	
}
